local chanrang = fk.CreateSkill {
  name = "water_chanrang",
}

Fk:loadTranslationTable{
  ["water_chanrang"] = "禅让",
  [":water_chanrang"] = "锁定技，当你受到伤害时，你可以选择弃置一张基本牌。若此做，此伤害无效，并使伤害来源恢复一点体力。",
  ["#water_chanrang_discard"] = "你可以弃置一张基本牌令此伤害无效并使伤害来源回复1体力",
}

chanrang:addEffect(fk.DamageInflicted, {
  anim_type = "defensive",
  can_trigger = function(self, event, target, player, data)
    return player:hasSkill(self.name) 
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    local card = room:askForCard(player, 1, 1, false, self.name, false, ".|.|.|.|.|basic", "#water_chanrang_discard")
    if #card > 0 then
      room:throwCard(card, self.name, player, player)
      if data.from then
        room:recover{
          who = data.from,
          num = 1,
          recoverBy = player,
          skillName = self.name,
        }
      end
      data:preventDamage() -- 伤害无效
    end
  end,
})

return chanrang 